﻿using DevTeam;
using System.Data;

namespace ConfExpert.Forms.Rapor.Aksesuar
{
    public partial class xrOrtakAksesuar : DevExpress.XtraReports.UI.XtraReport
    {
        int BosEtiket;
        DataSet ds;
        public xrOrtakAksesuar()
        {
            InitializeComponent();
        }

        public xrOrtakAksesuar(int BosEtiket, string TalepIds)
            : this()
        {
            this.BosEtiket = BosEtiket;
            ds = Session.DataManager.ExecuteDataSet("GetOrtakAksesuarEtiketi", TalepIds);

            for (int i = 0; i < BosEtiket; i++)
            {
                DataRow r = ds.Tables["Table"].NewRow();
                ds.Tables["Table"].Rows.InsertAt(r, 0);
            }

            this.DataMember = "Table";
            this.DataSource = ds;

            tcStokKod.DataBindings.Add("Text", null, "Table.StokKod");
            tcDosyaNo.DataBindings.Add("Text", null, "Table.DosyaNo");
        }

        private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            BosEtiket--;
        }

        private void tbAksesuar_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            if (BosEtiket > -1)
            {
                e.Cancel = true;
            }
        }
    }
}
